package com.yunhe.option.domain.base;

import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import org.neo4j.ogm.annotation.GeneratedValue;
import org.neo4j.ogm.annotation.Id;
import org.neo4j.ogm.annotation.NodeEntity;
import org.neo4j.ogm.annotation.Relationship;

import java.io.Serializable;
import java.util.List;

/**
 * @ClassName Enum
 * @Description TODO
 * @Author HeTao
 * @Date 2021/2/26 14:21
 * @Version 1.0
 **/
@ApiModel(value = "Enum",description = "枚举对象")
@NodeEntity
public class Enum implements Comparable<Enum>, Serializable {
    @Id
    @GeneratedValue
    @ApiModelProperty("枚举id")
    private Long id;

    @ApiModelProperty("枚举编码")
    private String name;

    @ApiModelProperty("枚举名称")
    private String title;

    @ApiModelProperty("状态")
    private String activity="1";

    @JsonIgnore
    private String sn;
    @Relationship(type = "HAS_ITEM")
    private List<Item> items;

    @Override
    public int compareTo(Enum o) {
        if (this.sn == null) {
            return -1;
        } else if (o.getSn() == null) {
            return 1;
        }
        return this.sn.compareTo(o.getSn());
    }

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getTitle() {
        return title;
    }

    public void setTitle(String title) {
        this.title = title;
    }

    public String getActivity() {
        return activity;
    }

    public void setActivity(String activity) {
        this.activity = activity;
    }

    public String getSn() {
        return sn;
    }

    public void setSn(String sn) {
        this.sn = sn;
    }

    public List<Item> getItems() {
        return items;
    }

    public void setItems(List<Item> items) {
        this.items = items;
    }
}